Optimal. Leaf size=137 \[ \frac {(b B-a C) x}{a^2+b^2}+\frac {(b B-a C) \cot (c+d x)}{a^2 d}-\frac {B \cot ^2(c+d x)}{2 a d}-\frac {\left (a^2 B-b^2 B+a b C\right ) \log (\sin (c+d x))}{a^3 d}-\frac {b^3 (b B-a C) \log (a \cos (c+d x)+b \sin (c+d x))}{a^3 \left (a^2+b^2\right ) d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.43, antiderivative size = 137, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 40, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.150, Rules used = {3713, 3690,
3730, 3732, 3611, 3556} \begin {gather*} \frac {x (b B-a C)}{a^2+b^2}+\frac {(b B-a C) \cot (c+d x)}{a^2 d}-\frac {\left (a^2 B+a b C-b^2 B\right ) \log (\sin (c+d x))}{a^3 d}-\frac {b^3 (b B-a C) \log (a \cos (c+d x)+b \sin (c+d x))}{a^3 d \left (a^2+b^2\right )}-\frac {B \cot ^2(c+d x)}{2 a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3611
Rule 3690
Rule 3713
Rule 3730
Rule 3732
Rubi steps
\begin {align*} \int \frac {\cot ^4(c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx &=\int \frac {\cot ^3(c+d x) (B+C \tan (c+d x))}{a+b \tan (c+d x)} \, dx\\ &=-\frac {B \cot ^2(c+d x)}{2 a d}-\frac {\int \frac {\cot ^2(c+d x) \left (2 (b B-a C)+2 a B \tan (c+d x)+2 b B \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx}{2 a}\\ &=\frac {(b B-a C) \cot (c+d x)}{a^2 d}-\frac {B \cot ^2(c+d x)}{2 a d}+\frac {\int \frac {\cot (c+d x) \left (-2 \left (a^2 B-b^2 B+a b C\right )-2 a^2 C \tan (c+d x)+2 b (b B-a C) \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx}{2 a^2}\\ &=\frac {(b B-a C) x}{a^2+b^2}+\frac {(b B-a C) \cot (c+d x)}{a^2 d}-\frac {B \cot ^2(c+d x)}{2 a d}-\frac {\left (b^3 (b B-a C)\right ) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{a^3 \left (a^2+b^2\right )}-\frac {\left (a^2 B-b^2 B+a b C\right ) \int \cot (c+d x) \, dx}{a^3}\\ &=\frac {(b B-a C) x}{a^2+b^2}+\frac {(b B-a C) \cot (c+d x)}{a^2 d}-\frac {B \cot ^2(c+d x)}{2 a d}-\frac {\left (a^2 B-b^2 B+a b C\right ) \log (\sin (c+d x))}{a^3 d}-\frac {b^3 (b B-a C) \log (a \cos (c+d x)+b \sin (c+d x))}{a^3 \left (a^2+b^2\right ) d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.95, size = 163, normalized size = 1.19 \begin {gather*} \frac {\frac {2 (b B-a C) \cot (c+d x)}{a^2}-\frac {B \cot ^2(c+d x)}{a}+\frac {(B+i C) \log (i-\tan (c+d x))}{a+i b}-\frac {2 \left (a^2 B-b^2 B+a b C\right ) \log (\tan (c+d x))}{a^3}+\frac {(B-i C) \log (i+\tan (c+d x))}{a-i b}+\frac {2 b^3 (-b B+a C) \log (a+b \tan (c+d x))}{a^3 \left (a^2+b^2\right )}}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.48, size = 152, normalized size = 1.11
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (a B +C b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (B b -C a \right ) \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {\left (B b -C a \right ) b^{3} \ln \left (a +b \tan \left (d x +c \right )\right )}{a^{3} \left (a^{2}+b^{2}\right )}-\frac {B}{2 a \tan \left (d x +c \right )^{2}}-\frac {-B b +C a}{a^{2} \tan \left (d x +c \right )}+\frac {\left (-a^{2} B +b^{2} B -C a b \right ) \ln \left (\tan \left (d x +c \right )\right )}{a^{3}}}{d}\) | \(152\) |
default | \(\frac {\frac {\frac {\left (a B +C b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (B b -C a \right ) \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {\left (B b -C a \right ) b^{3} \ln \left (a +b \tan \left (d x +c \right )\right )}{a^{3} \left (a^{2}+b^{2}\right )}-\frac {B}{2 a \tan \left (d x +c \right )^{2}}-\frac {-B b +C a}{a^{2} \tan \left (d x +c \right )}+\frac {\left (-a^{2} B +b^{2} B -C a b \right ) \ln \left (\tan \left (d x +c \right )\right )}{a^{3}}}{d}\) | \(152\) |
norman | \(\frac {\frac {\left (B b -C a \right ) \left (\tan ^{2}\left (d x +c \right )\right )}{a^{2} d}+\frac {\left (B b -C a \right ) x \left (\tan ^{3}\left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {B \tan \left (d x +c \right )}{2 a d}}{\tan \left (d x +c \right )^{3}}+\frac {\left (a B +C b \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \left (a^{2}+b^{2}\right )}-\frac {\left (a^{2} B -b^{2} B +C a b \right ) \ln \left (\tan \left (d x +c \right )\right )}{a^{3} d}-\frac {b^{3} \left (B b -C a \right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right ) a^{3} d}\) | \(179\) |
risch | \(\frac {2 i C b x}{a^{2}}+\frac {x C}{i b -a}+\frac {2 i b^{4} B x}{\left (a^{2}+b^{2}\right ) a^{3}}-\frac {2 i \left (i B a \,{\mathrm e}^{2 i \left (d x +c \right )}-B b \,{\mathrm e}^{2 i \left (d x +c \right )}+C a \,{\mathrm e}^{2 i \left (d x +c \right )}+B b -C a \right )}{a^{2} d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}-\frac {2 i b^{3} C c}{\left (a^{2}+b^{2}\right ) a^{2} d}+\frac {2 i C b c}{a^{2} d}-\frac {2 i b^{3} C x}{\left (a^{2}+b^{2}\right ) a^{2}}+\frac {2 i x B}{a}-\frac {2 i B \,b^{2} x}{a^{3}}+\frac {i x B}{i b -a}-\frac {2 i B \,b^{2} c}{d \,a^{3}}+\frac {2 i b^{4} B c}{\left (a^{2}+b^{2}\right ) d \,a^{3}}+\frac {2 i B c}{a d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{a d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B \,b^{2}}{d \,a^{3}}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) C b}{a^{2} d}-\frac {b^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{\left (a^{2}+b^{2}\right ) d \,a^{3}}+\frac {b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) C}{\left (a^{2}+b^{2}\right ) a^{2} d}\) | \(415\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 158, normalized size = 1.15 \begin {gather*} -\frac {\frac {2 \, {\left (C a - B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} - \frac {2 \, {\left (C a b^{3} - B b^{4}\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{5} + a^{3} b^{2}} - \frac {{\left (B a + C b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {2 \, {\left (B a^{2} + C a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )\right )}{a^{3}} + \frac {B a + 2 \, {\left (C a - B b\right )} \tan \left (d x + c\right )}{a^{2} \tan \left (d x + c\right )^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.00, size = 234, normalized size = 1.71 \begin {gather*} -\frac {B a^{4} + B a^{2} b^{2} + {\left (B a^{4} + C a^{3} b + C a b^{3} - B b^{4}\right )} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right )^{2} - {\left (C a b^{3} - B b^{4}\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right )^{2} + {\left (B a^{4} + B a^{2} b^{2} + 2 \, {\left (C a^{4} - B a^{3} b\right )} d x\right )} \tan \left (d x + c\right )^{2} + 2 \, {\left (C a^{4} - B a^{3} b + C a^{2} b^{2} - B a b^{3}\right )} \tan \left (d x + c\right )}{2 \, {\left (a^{5} + a^{3} b^{2}\right )} d \tan \left (d x + c\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 8.45, size = 2592, normalized size = 18.92 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 1.47, size = 214, normalized size = 1.56 \begin {gather*} -\frac {\frac {2 \, {\left (C a - B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} - \frac {{\left (B a + C b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} - \frac {2 \, {\left (C a b^{4} - B b^{5}\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{5} b + a^{3} b^{3}} + \frac {2 \, {\left (B a^{2} + C a b - B b^{2}\right )} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{a^{3}} - \frac {3 \, B a^{2} \tan \left (d x + c\right )^{2} + 3 \, C a b \tan \left (d x + c\right )^{2} - 3 \, B b^{2} \tan \left (d x + c\right )^{2} - 2 \, C a^{2} \tan \left (d x + c\right ) + 2 \, B a b \tan \left (d x + c\right ) - B a^{2}}{a^{3} \tan \left (d x + c\right )^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 10.93, size = 175, normalized size = 1.28 \begin {gather*} -\frac {{\mathrm {cot}\left (c+d\,x\right )}^2\,\left (\frac {B}{2\,a}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,b-C\,a\right )}{a^2}\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-C+B\,1{}\mathrm {i}\right )}{2\,d\,\left (-b+a\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (B\,a^2+C\,a\,b-B\,b^2\right )}{a^3\,d}-\frac {\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (B\,b^4-C\,a\,b^3\right )}{d\,\left (a^5+a^3\,b^2\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B-C\,1{}\mathrm {i}\right )}{2\,d\,\left (a-b\,1{}\mathrm {i}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________